Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DON-1112: Add user-friendly validation for amount errors on regular g… #1821

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

bdsl
Copy link
Contributor

@bdsl bdsl commented Jan 10, 2025

…iving form

image

) {
this.submitting = false;
this.stripeError = this.getStripeFriendlyError(error, context);
this.stripeError = getStripeFriendlyError(error, context);
this.toast.showError(this.stripeError);
this.stripeResponseErrorCode = error?.code;

this.jumpToStep('Payment details');
this.goToFirstVisibleError();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function below moved to stripe.service.ts to allow sharing with new component. Not sure if that's the best place to move it to - not sure if its idiomatic or not to put extra stuff in the file alongside the service class in Angular.

@bdsl bdsl force-pushed the DON-1112-regular-giving-validation branch from 984c9ed to 910ce74 Compare January 10, 2025 17:27
Instead of just displyaing the form as a toast we now add it to the
page, and also change the spinner back to a button to allow the donor to
stop watching it and perhaps try again.
@bdsl bdsl marked this pull request as ready for review January 10, 2025 17:35
Copy link
Contributor

@NoelLH NoelLH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly guessed about which bits are moved as running out of time today but all LGTM. Stepper interception approach is interesting, might be worth considering mirroring in the main form if we find it works well in practice.


export function getStripeFriendlyError(
error: StripeError | {message: string, code: string, decline_code?: string, description?: string} | undefined,
context: 'method_setup'| 'card_change'| 'confirm',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liking this narrower type; assuming rest of this is moved only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is just moved.

@bdsl bdsl merged commit 1cf214c into develop Jan 13, 2025
4 checks passed
@bdsl bdsl deleted the DON-1112-regular-giving-validation branch January 13, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants